package com.qq;

import com.google.gson.Gson;
import com.qq.model.Book;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;

public class yyy {
    public static void main(String[] args) {
        //将Java代码用json语言输出出来
        Book book = new Book(1,"jack","三国演义",20);
        Book book1 = new Book(1,"jack","三国演义",20);
        Book book2 = new Book(1,"jack","三国演义",20);
        Book book3 = new Book(1,"jack","三国演义",20);
        Book book4 = new Book(1,"jack","三国演义",20);

        List<Book> bookList = new ArrayList<>();
        bookList.add(book);
        bookList.add(book1);
        bookList.add(book2);
        bookList.add(book3);
        bookList.add(book4);

        System.out.println(bookList);
        Gson j = new Gson();
        String r = j.toJson(bookList);
        System.out.println(r);
    }
}
